import React, {Component} from 'react';

class InputComponent extends Component {

    constructor() {
        super();
        this.state = {
            value: '初始值'
        };

        this.handleChange = this
            .handleChange
            .bind(this);

    }

    handleChange(event) {
        this.setState({value: event.target.value})
    }

    render() {
        return (
            <div>
                <input type="text" value={this.state.value} onChange={this.handleChange}/>
                <span>{this.state.value}</span>
            </div>
        )
    }
}

export default InputComponent